﻿using Xejen.Communication.Configuration;
using Xejen.Communication.Soap.Configuration;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;

namespace Xejen.Communication.Soap.Abstract
{
    /// <summary>
    /// 表示Soap请求提供器
    /// </summary>
    /// <typeparam name="TSoapAddress"><inheritdoc cref="SoapAddress" path="/summary"/></typeparam>
    /// <creator>marc</creator>
    public interface ISoapInvoker<TSoapAddress>
    {
        /// <inheritdoc cref="SoapConfig"/>
        SoapConfig Config { get; set; }

        /// <summary>
        /// 发起请求
        /// </summary>
        /// <param name="address"><inheritdoc cref="SoapAddress" path="/summary"/></param>
        /// <param name="soapConfig">修改配置信息</param>
        /// <param name="timeout">超时时间，单位：毫秒</param>
        /// <param name="cancellationToken">是否取消的令牌</param>
        /// <returns></returns>
        Task<SoapResponse> InvokeServiceAsync(TSoapAddress address, SoapConfig soapConfig = null, int timeout = -1, CancellationToken cancellationToken = default);

        /// <summary>
        /// 发起请求
        /// </summary>
        /// <param name="address"><inheritdoc cref="SoapAddress" path="/summary"/></param>
        /// <param name="soapConfig">修改配置信息</param>
        /// <param name="input">请求数据</param>
        /// <param name="timeout">超时时间，单位：毫秒</param>
        /// <param name="cancellationToken">是否取消的令牌</param>
        /// <typeparam name="TInput">输入参数的类型</typeparam>
        /// <returns></returns>
        Task<SoapResponse> InvokeServiceAsync<TInput>(TSoapAddress address, TInput input, SoapConfig soapConfig = null, int timeout = -1, CancellationToken cancellationToken = default);
    }
}
